a=input()
s = ''
brackets = '()[]{}<>'
for x in a:
	if x in brackets:
		s += x
while '()' in s or '[]'in s or '{}' in s or '<>' in s:
	s = s.replace('()','').replace('[]','').replace('{}','').replace('<>','')
if len(s) !=0:
	print('False') 
else:
	print('True') 